package com.app.h5.pic.engine;

import android.content.Context;

import com.luck.picture.lib.engine.UriToFileTransformEngine;
import com.luck.picture.lib.interfaces.OnKeyValueResultCallbackListener;
import com.luck.picture.lib.utils.SandboxTransformUtils;

/**
 * ProjectName  TempleteProject-java
 * PackageName  com.lib.base.util.upload
 * @author      neo
 * Date         2022/2/9.
 */

public class MeSandboxFileEngine implements UriToFileTransformEngine {

    /*@Override
    public void onStartSandboxFileTransform(Context context, boolean isOriginalImage,
                                            int index, LocalMedia media,
                                            OnCallbackIndexListener<LocalMedia> listener) {
        if (PictureMimeType.isContent(media.getAvailablePath())) {
            String sandboxPath = SandboxTransformUtils.copyPathToSandbox(context, media.getPath(), media.getMimeType());
            media.setSandboxPath(sandboxPath);
        }
        if (isOriginalImage) {
            String originalPath = SandboxTransformUtils.copyPathToSandbox(context, media.getPath(), media.getMimeType());
            media.setOriginalPath(originalPath);
            media.setOriginal(!TextUtils.isEmpty(originalPath));
        }
        listener.onCall(media, index);
    }*/

    @Override
    public void onUriToFileAsyncTransform(Context context, String srcPath, String mineType, OnKeyValueResultCallbackListener call) {
        if (call != null) {
            call.onCallback(srcPath, SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType));
        }
    }
}